<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page contentType="text/html; charset=gb2312"%>
<%@page import="com.tss.util.*"%>
<%@page import="com.store.*"%>
<%@page import="java.util.*"%>
<%@page import="com.jedi.*"%>
<%@include file="../global_var.jsp"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
User just_user = (User)session.getAttribute("LoginUser");
String power_enable_id = "10703";
if (!just_user.hasPower(power_enable_id)) {
	out.println(strNoPowerInfo); 
	return;
}

int comid   	= Integer.parseInt(ParamUtils.getParameter(request,"comid","0"));//编号
String comname   = ParamUtils.getParameter(request,"comname","");//厂商名称
String comtel      = ParamUtils.getParameter(request,"comtel","");//代理商电话
String comaddress   = ParamUtils.getParameter(request,"comaddress","");//代理商地址
String comremark = ParamUtils.getParameter(request,"comremark","");//备注
String strErr = "";
CompanyMgr companyMgr = new CompanyMgr();
Company company = companyMgr.getComInfo(comid);
if (company == null) strErr = "此厂商信息不存在!";

String cmd = ParamUtils.getParameter(request,"cmd","");


if (cmd.trim().equals("update")) {
	if (strErr.trim().equals("") && comname.trim().equals("")) {
		strErr = "代理商名称不能为空!";
	}

if (strErr.trim().equals("")) {
	company.setComnam(comname);
		company.setComtel(comtel);
		company.setComaddress(comaddress);
		company.setComid(comid);
		company.setComremark(comremark);
		company.update();
		if (company.hasErr()) strErr = company.getErrHtml();
	}
}
if (strErr.trim().equals("")) {
	comid=company.getComid();
	comname=company.getComnam();
	comtel=company.getComtel();
	comaddress=company.getComaddress();
	comremark=company.getComremark();


}
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'company_detail.jsp' starting page</title>
    
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    
     
    <link href="style/main.css" rel="stylesheet" type="text/css">
<script language="javascript" src="js/common.js"></script>
<script language="javascript">
function clk_submit() {
	var oForm = document.operatorForm;
	oForm.cmd.value = "update";
	return true;
}
function clk_goback() {
	history.back();
}


</script>

</head>


  

<body  leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<form name="operatorForm" method="post" >
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td>
    
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
       
        
        <tr> 
          <td height="100" align="center" valign="top" style="padding-top:10px;padding-bottom:10px;">
            <table width="98%" border="0" cellpadding="1" cellspacing="1" bgcolor="#000000">
              
              <%if (!strErr.trim().equals("")) {%>
              <tr> 
                <td height="24" colspan="2" bgcolor="#D7D7DB" style="padding-left:10px;">
                  错误提示：<font color=red><%=strErr%></font>
                </td>
              </tr>
              <%}%>
              <%if (strErr.trim().equals("")) {%>
              <tr> 
                <td height="24" colspan="2" bgcolor="#858585" style="padding-left:10px;">
                  <font color="#FFFFFF"><strong>厂商信息</strong></font>                </td>
              </tr>
                 <%}%>
			  <tr> 
                <td width="14%" height="24" align="right" bgcolor="#D7D7DB" style="padding-right:5px;">厂商编号<span style="padding-right:5px;"><font color="red">*</font></span></td>
                <td width="86%" bgcolor="#EDEDF0" style="padding-left:5px;">
        
                <%=company.getComid()%>
                  </td>
              </tr>
                <tr> 
                <td height="24" align="right" bgcolor="#D7D7DB" style="padding-right:5px;">厂商名称<span style="padding-right:5px;"><font color="red">*</font></span></td>
                <td bgcolor="#EDEDF0" style="padding-left:5px;"> 
              
                   <input type="text" value="<%=comname%>" name="comname" size="50" maxlength="100" class="inputBox">
                  </td>
                  
              </tr>
             
			   <tr> 

                <td height="24" align="right" bgcolor="#D7D7DB" style="padding-right:5px;">厂商电话：</td>
                <td bgcolor="#EDEDF0" style="padding-left:5px;">
					
						 <input type="text" value="<%=comtel%>" name="comtel"  class="inputBox" size="30" maxlength="30">
				    </td>
              </tr>
              <tr> 

                <td height="24" align="right" bgcolor="#D7D7DB" style="padding-right:5px;">创建时间：</td>
                <td bgcolor="#EDEDF0" style="padding-left:5px;"> 
               <input type="text" value="<%=company.getCreatetime()%>" name="createtime" class="inputBox" class="inputBox" size="30" maxlength="30" style="background-color:#EDEDE8" readonly="readonly">
                 </td>
              </tr>
                <tr> 

                <td height="24" align="right" bgcolor="#D7D7DB" style="padding-right:5px;">厂商备注：</td>
                <td bgcolor="#EDEDF0" style="padding-left:5px;"> 
              <TEXTAREA name="comremark" cols="50" rows="4"><%=comremark%></TEXTAREA>
                 </td>
              </tr>
               <tr>
                <td height="24" align="right" bgcolor="#D7D7DB" style="padding-right:5px;">厂商地址：</td>
                <td bgcolor="#EDEDF0" style="padding-left:5px;">
                  <input name="comaddress" type="text"  size="80" maxlength="100" value="<%=comaddress%>" class="inputBox" >
                  
            	</td>
              </tr>
           
              
            
              <tr> 
                <td bgcolor="#EDEDF0" colspan="2" align="center">
                <input type="submit" value="修改" class="inputButton" onclick="clk_submit()">
                  <input type="button" onclick="clk_goback();" name="btn" value="返回" class="inputButton"> 
                <input type="hidden" name="cmd" value="">   
               
                </td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
</form>
<%if (cmd.equals("update") && strErr.trim().equals("")){%>
<script language="javascript">
alert("厂商信息修改成功系统将返回!");
location.href="company_list.jsp";

</script>
<%}%>
</body>
</html>
